<?php
class User{

public $id;
public $userName;
public $userRole;


/**
根据id,获取数组中的username
**/
public function getUserName($id,$allUser){
	$userName = "";
	foreach($allUser as $user){
		if($id == $user->id){
			return $user->userName;
		}
	}
	if($userName == ""){
		$userName = "UserID:$id 找不到对应的名字";
	}
	return $userName;
}


}//end class

?>